/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// pnotebk.hpp - Notebook window class definition.
//
// Author: Kenneth G. Maxwell
//
// Copyright (c) 1997-2000 Swell Software 
//              All Rights Reserved.
//
// Unauthorized redistribution of this source code, in whole or part,
// without the express written permission of Swell Software
// is strictly prohibited.
//
// Notes:
//
// Notebook windows have tabs at the top or bottom. The number of tabs
// is defined when the notebook window is constructed. What appears on each
// tab may be either simple text or any PegThing derived object type. 
// Likewise, a PegWindow derived object should be associated with
// each tab. The Notebook window takes care of displaying the correct window
// as each tab is selcted.
//
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/

#ifndef _PEGNOTEBOOK_
#define _PEGNOTEBOOK_

class PegNotebook : public PegWindow
{
    public:
        PegNotebook(const PegRect &Rect, PEGULONG Style, PEGUBYTE NumTabs);
        virtual ~PegNotebook();

        void CalculateTabPositions(void);
        virtual void Draw(const PegRect &Invalid);
        PEGUBYTE GetCurrentPage(void) {return mSelectedTab;}
        PegThing *GetPageClient(PEGUBYTE Index);
        PegThing *GetTabClient(PEGUBYTE Index);

        virtual PEGINT Message(const PegMessage &Mesg);
        PegThing *RemovePageClient(PEGUBYTE Index);
        void ResetNumTabs(PEGUBYTE Num);
        void ResetTabStyle(PEGULONG Style);
        void SelectTab(PEGUBYTE Tab);
        virtual void SetFont(PEGUINT Index);

        void SetPageClient(PEGUBYTE Index, PegThing *pPageClient);
        void SetTabClient(PEGUBYTE Index, PegThing *pTabClient);
        void SetTabString(PEGUBYTE Index, PEGINT StringId);
        void SetTabString(PEGUBYTE Index, const PEGCHAR *String);

        enum MyIds 
        {
            NB_SPIN = 1000
        };

    protected:
        virtual void AddCurrentPageClient();
        PEGBOOL CheckTabClick(PegPoint Click);
        virtual void DrawFrame(PEGBOOL Fill = TRUE);
        void DrawTabs(const PegRect &Invalid, PEGBOOL Selected);
        void RedrawTabs(void);

        PEGCHAR **mpTabStrings;


        PegThing **mpTabClients;
        PegThing **mpPageClients;
        PegSpinButton *mpSpin;

        PEGINT mTabWidth;
        PEGINT mTabHeight;
        PEGUBYTE mSelectedTab;
        PEGUBYTE mNumTabs;
        PEGUBYTE mVisibleTabs;
        PEGUBYTE mFirstTab;
};

#endif


